﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.Web.DynamicData;
using Infragistics.WebUI.Shared;

public partial class DateTime_EditField : System.Web.DynamicData.FieldTemplateUserControl 
{
    protected void Page_Load(object sender, EventArgs e) 
    {
        WebCalendarView1.ToolTip = Column.Description;
    }

    protected override void OnDataBinding(EventArgs e)
    {
        base.OnDataBinding(e);

        if (Mode == DataBoundControlMode.Edit) 
        {
            if (FieldValue != null)
            {
                DateTime fieldDate = (DateTime)FieldValue;
                WebSchenduleInfo1.ActiveDayUtc = new SmartDate(fieldDate);
            }
            else
            {
                WebSchenduleInfo1.ActiveDayUtc = new SmartDate(DateTime.Now);
            }
        }
    }



    protected override void ExtractValues(IOrderedDictionary dictionary)
    {
        dictionary[Column.Name] = ConvertEditedValue(WebSchenduleInfo1.ActiveDayUtc.ToLocalTime().Date.ToString());
    }
}
